import requests

# #使用rquests库完成文件下载
# image_url = 'http://www.woniuxy.com/upload/image/201810/20181031_175329_571.jpg'
# r = requests.get(image_url)
# content = r.content
# with open('test_download.jpg', 'wb') as file:
#     file.write(content)


import http.client

# 使用http.client库完成文件下载
image_url = '/upload/image/201810/20181031_175329_571.jpg'
conn = http.client.HTTPConnection('www.woniuxy.com', 80)
conn.request('GET', image_url)
content = conn.getresponse().read()
with open('test_download_http.jpg', 'wb') as file:
    file.write(content)
